<template>

    <div>
      <span>{{comment.userName}}</span>
      <span>{{dateFormat(comment.addTime)}}</span>
      <el-rate :disabled="true" v-model="comment.rate"></el-rate>

      <span v-for="food in comment.foods" :key="food.id">{{food.title+ ":"  +food.count + "份   "}}</span>
      <br/>
      <span>{{comment.content}}</span>
      <el-divider></el-divider>
    </div>

</template>

<script>
  import moment from 'moment'
    export default {
        name: "Comment",
      props: {
        comment: {},
      },
      data() {
          return {

          }
      },
      methods: {
        // 格式化时间
        dateFormat(addtime) {
          var date = addtime;
          if (date === undefined) {
            return ''
          }
          return moment(date).format("YYYY-MM-DD HH:mm:ss")
        }
      }
    }
</script>

<style scoped>
  body .el-scrollbar__wrap {
    overflow-x: hidden;
  }
</style>
